//
//  TailDetailTableViewCell.m
//  陶瓷
//
//  Created by 郭天龙 on 15/7/7.
//  Copyright (c) 2015年 王戈. All rights reserved.
//

#import "TailDetailTableViewCell.h"

@interface TailDetailTableViewCell ()

@property (nonatomic, weak) IBOutlet UILabel *label1;
@property (nonatomic, weak) IBOutlet UILabel *label2;
@property (nonatomic, weak) IBOutlet UILabel *label3;
@property (nonatomic, weak) IBOutlet UILabel *label4;
@property (nonatomic, weak) IBOutlet UILabel *label5;
@property (nonatomic, weak) IBOutlet UILabel *label6;
@property (nonatomic, weak) IBOutlet UILabel *label7;

@end

@implementation TailDetailTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

- (void)setModel:(NSDictionary *)dic {

    NSMutableAttributedString *brandStr = [[NSMutableAttributedString alloc] initWithString:[[NSMutableString stringWithFormat:@"品牌：%@",[dic objectForKey:@"Brand"]] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
    [brandStr addAttribute:NSForegroundColorAttributeName value:[UIColor grayColor] range:NSMakeRange(0, 3)];
    
    NSMutableAttributedString *standardStr = [[NSMutableAttributedString alloc] initWithString:[[NSString stringWithFormat:@"规格：%@",[dic objectForKey:@"Standard"]] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
    [standardStr addAttribute:NSForegroundColorAttributeName value:[UIColor grayColor] range:NSMakeRange(0, 3)];
    
    NSMutableAttributedString *countStr = [[NSMutableAttributedString alloc] initWithString:[[NSString stringWithFormat:@"数量：%@",[dic objectForKey:@"Count"]] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
    [countStr addAttribute:NSForegroundColorAttributeName value:[UIColor grayColor] range:NSMakeRange(0, 3)];
    
    NSMutableAttributedString *priceStr = [[NSMutableAttributedString alloc] initWithString:[[NSString stringWithFormat:@"价格：%@",[dic objectForKey:@"Price"]] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
    [priceStr addAttribute:NSForegroundColorAttributeName value:[UIColor grayColor] range:NSMakeRange(0, 3)];
    
    NSMutableAttributedString *linkmanStr = [[NSMutableAttributedString alloc] initWithString:[[NSString stringWithFormat:@"联系人：%@",[dic objectForKey:@"LinkMan"]] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
    [linkmanStr addAttribute:NSForegroundColorAttributeName value:[UIColor grayColor] range:NSMakeRange(0, 4)];
    
    NSMutableAttributedString *contactNumberStr = [[NSMutableAttributedString alloc] initWithString:[[NSString stringWithFormat:@"联系电话：%@",[dic objectForKey:@"ContactNumber"]] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
    [contactNumberStr addAttribute:NSForegroundColorAttributeName value:[UIColor grayColor] range:NSMakeRange(0, 5)];
    
    NSMutableAttributedString *addressStr = [[NSMutableAttributedString alloc] initWithString:[[NSString stringWithFormat:@"公司地址：%@",[dic objectForKey:@"CompanyAddress"]] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];
    [addressStr addAttribute:NSForegroundColorAttributeName value:[UIColor grayColor] range:NSMakeRange(0, 5)];
    
    self.label1.attributedText = brandStr;
    self.label2.attributedText = standardStr;
    self.label3.attributedText = countStr;
    self.label4.attributedText = priceStr;
    self.label5.attributedText = linkmanStr;
    self.label6.attributedText = contactNumberStr;
    self.label7.attributedText = addressStr;
}

- (void)setCompany:(CompanyModel *)company {
    _company = company;
    
    NSMutableAttributedString *brandStr = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"公司品牌：%@",company.Brand]];
    [brandStr addAttribute:NSForegroundColorAttributeName value:[UIColor grayColor] range:NSMakeRange(0, 5)];
    
    NSMutableAttributedString *nameStr = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"公司：%@",company.Name]];
    [nameStr addAttribute:NSForegroundColorAttributeName value:[UIColor grayColor] range:NSMakeRange(0, 3)];
    
    NSMutableAttributedString *linkManStr = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"联系人：%@",company.LinkMan]];
    [nameStr addAttribute:NSForegroundColorAttributeName value:[UIColor grayColor] range:NSMakeRange(0, 4)];
    
    NSMutableAttributedString *contactNoStr = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"联系电话：%@",company.ContactNumber]];
    [contactNoStr addAttribute:NSForegroundColorAttributeName value:[UIColor grayColor] range:NSMakeRange(0, 5)];
    
    NSMutableAttributedString *AddressStr = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"公司地址：%@",company.Address]];
    [AddressStr addAttribute:NSForegroundColorAttributeName value:[UIColor grayColor] range:NSMakeRange(0, 5)];
    
    self.label1.attributedText = brandStr;
    self.label2.attributedText = nameStr;
    self.label3.attributedText = linkManStr;
    self.label4.attributedText = contactNoStr;
    self.label5.attributedText = AddressStr;
}

@end
